package designpattern.abstractfactory.factory;

import designpattern.abstractfactory.service.Color;
import designpattern.abstractfactory.service.Price;
import designpattern.abstractfactory.service.Shape;

public class ColorFactory extends AbstractFactory {
    @Override
    public Color getColor(Class<? extends Color> clazz) {
       if (clazz == null){
           throw new RuntimeException("类路径不能为空");
       }
       Color color = null;
       try {
           color = (Color) clazz.newInstance();
       }catch (Exception e){
           e.printStackTrace();
           System.out.println(e.getMessage());
       }
       return color;
    }

    @Override
    public Shape getShape(Class<? extends Shape> clazz) {
        return null;
    }

    @Override
    public Price getPrice(Class<? extends Price> clazz) {
        return null;
    }
}
